package com.study.english.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.study.english.pojo.vo.PlStudyPlanVideoVo;
import com.study.english.result.Result;
import com.study.english.service.IPlStudyPlanVideoService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

import com.study.english.domain.PlStudyPlanVideo;

import org.springframework.web.bind.annotation.*;

/**
 * 学习计划内容
 *
 * @author wf
 * @description 针对表【pl_study_plan_video(学习计划内容)】的数据库操作Controller
 * @createDate 2024-06-27 15:28:53
 */
@RestController
@RequestMapping("plStudyPlanVideo")
public class PlStudyPlanVideoController {

    @Autowired
    private IPlStudyPlanVideoService plStudyPlanVideoService;


    /**
     * 新增:学习计划内容
     */
    @PostMapping("addPlStudyPlanVideo")
    public Result addPlStudyPlanVideo(@RequestBody PlStudyPlanVideoVo plStudyPlanVideoVo) {
        plStudyPlanVideoService.addPlStudyPlanVideo(plStudyPlanVideoVo);
        return Result.success();

    }


    /**
     * 分页查询:学习计划内容
     */
    @PostMapping("getPlStudyPlanVideoPageList")
    public Result getPlStudyPlanVideoPageList(@RequestBody PlStudyPlanVideoVo plStudyPlanVideoVo) {

        IPage<PlStudyPlanVideoVo> page = new Page<>(plStudyPlanVideoVo.getPageNum(), plStudyPlanVideoVo.getPageSize());
        IPage<PlStudyPlanVideoVo> list = plStudyPlanVideoService.getPlStudyPlanVideoPageList(page, plStudyPlanVideoVo);
        return Result.success(list);
    }


    /**
     * 不分页查询:学习计划内容
     */

    @PostMapping("getPlStudyPlanVideoList")
    public Result getPlStudyPlanVideoList(@RequestBody PlStudyPlanVideoVo plStudyPlanVideoVo) {
        List<PlStudyPlanVideoVo> plStudyPlanVideoVoList = plStudyPlanVideoService.getPlStudyPlanVideoList(plStudyPlanVideoVo);

        return Result.success(plStudyPlanVideoVoList);
    }

    /**
     * 根据id查询详情:学习计划内容
     */

    @GetMapping("getPlStudyPlanVideoById")
    public Result getPlStudyPlanVideoById(@RequestParam Long id) {
        PlStudyPlanVideoVo plStudyPlanVideo = plStudyPlanVideoService.getPlStudyPlanVideoById(id);
        return Result.success(plStudyPlanVideo);
    }

    /**
     * 根据id删除:学习计划内容
     */
    @GetMapping("delPlStudyPlanVideo")
    public Result delPlStudyPlanVideo(@RequestParam Long id) {
        plStudyPlanVideoService.delPlStudyPlanVideo(id);
        return Result.success();
    }


    /**
     * 修改:学习计划内容
     */
    @PostMapping("updatePlStudyPlanVideo")
    public Result updatePlStudyPlanVideo(@RequestBody PlStudyPlanVideoVo plStudyPlanVideoVo) {
        plStudyPlanVideoService.updatePlStudyPlanVideo(plStudyPlanVideoVo);
        return Result.success();

    }
}
